package beans;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.*;
import javax.persistence.OneToMany;




/**
 * The persistent class for the societe database table.
 * 
 */
@Entity
@Table(name="societe")
public class Societe implements Serializable 
{
	private static final long serialVersionUID = 1L;

	
    @OneToMany(mappedBy="comp", cascade={CascadeType.PERSIST, CascadeType.DETACH},orphanRemoval=true) 
    private List<Utilisateur> userlist;
	

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="idSociete")
	private int idSociete;

	private int accredite;

	@Column(unique=true)
	private String nomSociete;

	public Societe() 
	{
	}

	public int getIdSociete() {
		return this.idSociete;
	}

	public void setIdSociete(int idSociete) {
		this.idSociete = idSociete;
	}

	public int getAccredite() {
		return this.accredite;
	}

	public void setAccredite(int accredite) {
		this.accredite = accredite;
	}

	public String getNomSociete() {
		return this.nomSociete;
	}

	public void setNomSociete(String nomSociete) 
	{
		this.nomSociete = nomSociete;
	}

	public List<Utilisateur> getUserlist() 
	{
		if (userlist==null)
		{
			userlist = new ArrayList<Utilisateur>();
		}
		return userlist;
	}

	public void setUserlist(List<Utilisateur> userlist) {
		this.userlist = userlist;
	}

	public Societe ajouterUtilisateur (Utilisateur user)
	{
		getUserlist().add(user);
		return this;
	}
	




	
}